<template>
  <div class="continer">
    <p>{{$t('configLazyLoad.channel.APPInteTip')}}</p>
    <div class="sdk_warp clearfix">
      <div class="sdk_btn">
        <a :href="sdkData.sdk === 'android' ? androidDownloadUrl : iosDownloadUrl" target="_blank">
          <P v-text="sdkData.sdk === 'android' ? 'Android SDK ' + androidVersion : 'IOS SDK ' + iosVersion"></P>
          <P>{{$t('public.download')}}</P>
        </a>
      </div>
      <!--<div class="sdk_btn">-->
        <!--<a :href="sdkData.sdk === 'android' ? androidVideoDownloadUrl : iosVideoDownloadUrl" target="_blank">-->
          <!--<P v-text="sdkData.sdk === 'android' ? 'Android SDK ' + androidVideoVersion : 'IOS SDK ' + iosVideoVersion"></P>-->
          <!--<P>下载 (含视频)</P>-->
        <!--</a>-->
      <!--</div>-->
    </div>
    <p>{{$t('configLazyLoad.channel.APPInteTip2')}}</p>
    <div>
      <el-input style="width: 280px;margin: 20px" size="mini" type="text" v-model="accountId" :disabled="true"></el-input> <el-button @click="copy" size="small">{{$t('configLazyLoad.channel.copyToClip')}}</el-button>
    </div>
    <p v-text="sdkData.sdk === 'android' ? $t('configLazyLoad.channel.checkAndroidDoc') : $t('configLazyLoad.channel.checkIOSDoc')"></p>
    <div class="sdk_btn" :class="{oem_7moor:$store.state.oemObj.oemFlag}">
      <a :href="sdkData.sdk === 'android' ? androidSdkDocUrl : iosSdkDocUrl" target="_blank">
        <P v-text="sdkData.sdk === 'android' ? 'Android SDK' : 'IOS SDK'"></P>
        <P>{{$t('configLazyLoad.channel.checkDoc')}}</P>
      </a>
    </div>
  </div>
</template>
<script>
  import Clipboard from 'clipboard-js'
  export default {
    name: 'AppSdkAccess',
    data () {
      return {
        accountId: '',
        androidDownloadUrl: 'http://7xqpis.com1.z0.glb.clouddn.com/M7KF-1.0.1%28Android%29.rar',
        androidVideoDownloadUrl: 'https://fs-kefu-sdk.7moor.com/M7KFWithVideo-v2.2.0%28Android%29.zip',
        androidSdkDocUrl: 'http://7xqpis.com1.z0.glb.clouddn.com/%E5%AE%B9%E8%81%94%E4%B8%83%E9%99%8C%E5%AE%A2%E6%9C%8DIMSDK%E9%9B%86%E6%88%90%E6%96%87%E6%A1%A3%28Android%29.pdf',
        iosDownloadUrl: 'http://7xqpis.com1.z0.glb.clouddn.com/%E5%AE%B9%E8%81%94%E4%B8%83%E9%99%8C%E5%AE%A2%E6%9C%8DIMSDK%28iOS%29.zip',
        iosVideoDownloadUrl: 'https://fs-kefu-sdk.7moor.com/M7KFWithVideo-1.8.0%28iOS-OC%29.zip',
        iosSdkDocUrl: 'http://7xqpis.com1.z0.glb.clouddn.com/%E5%AE%B9%E8%81%94%E4%B8%83%E9%99%8C%E5%AE%A2%E6%9C%8DIMSDK%E9%9B%86%E6%88%90%E6%96%87%E6%A1%A3%28iOS%29.zip',
        androidVersion: 'v1.0',
        androidVideoVersion: 'v2.2.0',
        iosVersion: 'v1.0',
        iosVideoVersion: 'v1.8.0'
      }
    },
    props: {
      sdkData: {
        type: Object,
        default: {}
      },
      versionData: {
        type: Object,
        default: {}
      }
    },
    watch: {
      sdkData: 'fetchData'
    },
    components: {},
    computed: {},
    methods: {
      fetchData () {
        this.accountId = this.sdkData.data.accessId
        this.androidDownloadUrl = this.versionData.androidDownloadUrl || 'http://7xqpis.com1.z0.glb.clouddn.com/M7KF-1.0.1%28Android%29.rar'
        this.androidVideoDownloadUrl = this.versionData.androidVideoDownloadUrl || 'https://fs-kefu-sdk.7moor.com/M7KFWithVideo-v2.2.0%28Android%29.zip'
        this.androidSdkDocUrl = this.versionData.androidSdkDocUrl || 'http://7xqpis.com1.z0.glb.clouddn.com/%E5%AE%B9%E8%81%94%E4%B8%83%E9%99%8C%E5%AE%A2%E6%9C%8DIMSDK%E9%9B%86%E6%88%90%E6%96%87%E6%A1%A3%28Android%29.pdf'
        this.iosDownloadUrl = this.versionData.iosDownloadUrl || 'http://7xqpis.com1.z0.glb.clouddn.com/%E5%AE%B9%E8%81%94%E4%B8%83%E9%99%8C%E5%AE%A2%E6%9C%8DIMSDK%28iOS%29.zip'
        this.iosVideoDownloadUrl = this.versionData.iosVideoDownloadUrl || 'https://fs-kefu-sdk.7moor.com/M7KFWithVideo-1.8.0%28iOS-OC%29.zip'
        this.iosSdkDocUrl = this.versionData.iosSdkDocUrl || 'http://7xqpis.com1.z0.glb.clouddn.com/%E5%AE%B9%E8%81%94%E4%B8%83%E9%99%8C%E5%AE%A2%E6%9C%8DIMSDK%E9%9B%86%E6%88%90%E6%96%87%E6%A1%A3%28iOS%29.zip'
        this.androidVersion = this.versionData.androidVersion || 'v1.0'
        this.androidVideoVersion = this.versionData.androidVideoVersion || 'v2.2.0'
        this.iosVersion = this.versionData.iosVersion || 'v1.0'
        this.iosVideoVersion = this.versionData.iosVideoVersion || 'v1.8.0'
      },
      copy () {
        let self = this
        Clipboard.copy(this.accountId).then(
          function () {
            self.$message.success(self.$t('configLazyLoad.channel.copySucc'))
          }
        )
      }
    },
    mounted: function () {
      this.fetchData()
    },
    beforeMount () {
    }
  }
</script>

<style lang="stylus" scoped>
  @import "../../../../../assets/common.styl"
  .continer
    padding 20px 15px
    .sdk_btn
      border 1px solid $c-main
      width 157px
      height 60px
      border-radius 10px
      display inline-block
      margin 20px
      cursor pointer
      color $c-main
      font-weight 600
      padding 12px
      box-sizing border-box
      a
        color $c-main
      p
        text-align center
</style>
